#ifndef __DXVIDEO_H__
#define __DXVIDEO_H__

extern "C" {
#define DIRECTDRAW_VERSION	0x0700
#include <windows.h>
#include <ddraw.h>

#include "defines.h"
#include "window.h"
}

class CDX7Video
	{
	protected:
		u8 *dest;
		int linesize;
	public:
		int width,height,bpp;
		HWND hwnd;
		HDC hdc;
		HINSTANCE hinstance;
		RECT rect;
		DDSURFACEDESC2 ddsd;
		LPDIRECTDRAW7 lpDD;
		LPDIRECTDRAWSURFACE7 lpDDSPrimary;
		LPDIRECTDRAWSURFACE7 lpDDSBack;
		LPDIRECTDRAWCLIPPER lpClipper;
		u8 *screen8;
		u16 *screen16;
		u32 *screen32;
		int mode;
		int renderstart;
	protected:
		void ShowError(int error,char *func);
	public:
		CDX7Video(){}
		int Init(HWND wnd,HINSTANCE inst,int w,int h,int bpp=0);	//init video interface
		void Kill();						//destroy video interface
		void Resize();						//hwnd changed size, acknowledge
		void StartBlit();					//beginning of frame, start blit
		void StopBlit();					//end of frame, no more drawing allowed
		void *GetSurface();				//pointer to surface
		int GetPitch();					//line size (in bytes) of surface
	};
	
#endif
